newEntity{
	define_as = "ELEMENTAL",
	type = "elemental", subtype = "elemental",
	display = "E", color=colors.ORCHID,
	name = "Mana elemental",
	desc = "This strange scintillating elemental seems to blink in and out of reality",
	level_range = {1, 50}, exp_worth = 1,
	rarity = 1,
	rank = 1,
	max_life = resolvers.rngavg(15,20),
	stats = { str=15, dex=15, con=15 },
	ai = "dumb_talented_simple", ai_state = { talent_in=3, },
	combat = { dam=2, atk=10, apr=2, damtype=DamageType.MANA },
	combat_armor = 0, combat_defense = 0,
	resists = { [DamageType.COLD] = 50, [DamageType.EARTH] = 50, [DamageType.FIRE] = 50, [DamageType.LIGHTNING] = 50, [DamageType.MANA] = 50, [DamageType.CHAOS] = -50, },
	faction = "mana",
}

-- the boss, no rarity means it will not be randomly generated.  End game quest for chaos elementals.
newEntity{
	define_as = "ELEMENTAL_BOSS",
	type = "elemental", subtype = "elemental",
	display = "E", color=colors.ORCHID,
	name = "Akraad, Ruler of Mystery",
	desc = "At first glance he seems to shimmer and shine, but the longer you stare the more it seems like he is constant and the world around you is in constant flux.",
	level_range = {25, 50}, exp_worth = 1,
	rank = 5,
	body = { INVEN = 100, BODY = 1, CLOAK = 1, HEAD = 1, BELT = 1, HANDS = 1, FEET = 1 },
	max_life = resolvers.rngavg(150,200),
	stats = { str=25, dex=25, con=25 },
	ai = "dumb_talented_simple", ai_state = { talent_in=3, },
	combat = { dam=12, atk=10, apr=2, damtype=DamageType.MANA },
	combat_armor = 10, combat_defense = 0,
	resists = { [DamageType.COLD] = 80, [DamageType.EARTH] = 80, [DamageType.FIRE] = 80, [DamageType.LIGHTNING] = 80, [DamageType.MANA] = 80, },
	faction = "mana",
	resolvers.equip{
		{type="armor", subtype="head", defined="ELEMENTAL_ARTIFACT", autoreq=true},
	},
	on_die = function(self, who)
		if game.player.faction == "chaos" then
--			game.player:resolveSource():
			game.player:setQuestStatus("destroy-mana", engine.Quest.COMPLETED, "mana-guardian")
--			local D = require "engine.Dialog"
--			D:simplePopup("Winner!", "#VIOLET#Congratulations, you have won the game! Now Chaos shall rule supreme!")		
		end
	end,
	
	can_talk = "boss-mana"
}
